package Stream;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;

/**
 * @author chihb
 * @create-time 2024/7/9 5:07
 * @description
 */
public class Test2 {
    public static void main(String[] args) {
        ArrayList<String> list=new ArrayList<>();
        Collections.addAll(list,"张无忌","周芷若","赵敏","张强","张三丰","张翠山","张良","王二麻子","谢广坤","张无忌");
        //list.stream().filter(s->s.startsWith("张")&&s.length()==3).forEach(System.out::println);
        //list.stream().limit(5).forEach(System.out::println);
        //list.stream().skip(2).forEach(System.out::println);
        //list.stream().limit(6).skip(3).forEach(System.out::println);
        //list.stream().skip(3).limit(3).forEach(System.out::println);
        //list.stream().distinct().forEach(System.out::println);
        ArrayList<String> list2=new ArrayList<>();
        Collections.addAll(list2,"张无忌-22","周芷若-22","赵敏-22","张强-22","张三丰-22","张翠山-22","张良-22","王二麻子-22","谢广坤-22","张无忌-22");
        list2.stream().map(s->Integer.parseInt(s.split("-")[1])).forEach(System.out::println);
        List<String> collect = list2.stream().filter(s -> "22".equals(s.split("-")[1])).toList();
    }
}
